<template>
  <div id="app" :class="styleList">
    <div id="nav">
      <router-link class="router-link" :class="hoverList" to="/"
        >Home</router-link
      >
      |
      <router-link class="router-link" :class="hoverList" to="/clipboard"
        >clipboard</router-link
      >|
      <router-link class="router-link" :class="hoverList" to="/settings"
        >settings</router-link
      >|
      <router-link class="router-link" :class="hoverList" to="/about"
        >about</router-link
      >
    </div>
    <router-view class="w960" />
  </div>
</template>

<script>

export default {
  name: 'App',
  components: { },
  data () {
    return {

    }
  },
  methods: {
    test () {
      chrome.bookmarks.getTree((res) => {
        console.log(res[0].children[0])
      })
    }
  },
  computed: {
    theme () {
      return this.$store.state.theme
    },
    isLight () {
      return this.theme === 'light'
    },
    isDark () {
      return this.theme === 'dark'
    },
    styleList () {
      return {
        'light-bg-ft': this.isLight, 'dark-bg-ft': this.isDark
      }
    },
    hoverList () {
      return {
        'light-bg-ft': this.isLight,
        'dark-bg-ft': this.isDark,
        'light-a': this.isLight,
        'dark-a': this.isDark
      }
    }
  },
  created () {
    const theme = localStorage.getItem('theme')
    if (theme !== 'light' && theme !== 'dark') {
      localStorage.setItem('theme', 'light')
      this.$store.commit({ type: 'switchTheme', theme: 'light' })
    } else { this.$store.commit({ type: 'switchTheme', theme: theme }) }
  }
}
</script>
<style lang="scss">
// @import "@/global";
@import "@/theme";

.router-link {
  font-size: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  // height: 100%;
  margin: 0;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  width: 100%;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.w960 {
  width: 960px;
}

.bigTxt {
  font-size: 24px;
}
</style>
